package com.kevin.spring;

import com.kevin.spring.tx.User;
import com.kevin.spring.tx.UserDaoInter;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

/**
 * Created by loli on 2015/6/10.
 */
public class TxDemo {
    public static  void main(String[] args){
        ApplicationContext factory = new ClassPathXmlApplicationContext("spring-tx.xml");;
        UserDaoInter userDao = (UserDaoInter) factory.getBean("userDao");
        User user = new User();
        user.setName("kevin");
        user.setPassword("kevin");
        userDao.add(user);

        UserDaoInter userDao2 = (UserDaoInter) factory.getBean("userDao2");
        userDao2.add(user);
    }
}
